package app.boot;

import java.util.ArrayList;

public class LowMap {
    public ArrayList<Object> keys = new ArrayList<>();
    public ArrayList<Object> values = new ArrayList<>();

    public void put(Object key , Object value) {
        keys.add(key);
        values.add(value);
    }

    public void remove(Object key) {
        int index = keys.indexOf(key);
        keys.remove(index);
        values.remove(index);
    }

    public Object get(Object key) {
        int index = keys.indexOf(key);
        return values.get(index);
    }

    @Override
    public String toString() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("{");
        for (Object key : keys) {
            stringBuffer.append(key.toString());
            stringBuffer.append("=");
            int index = keys.indexOf(key);
            stringBuffer.append(values.get(index).toString());
            if (index < keys.size()) {
                stringBuffer.append(",");
            }
        }
        return stringBuffer.toString();
    }
}
